Skip to content

Refactoring: remove library interfaces#157

Open
lefessan wants to merge 10 commits intoOCamlPro:masterfrom
lefessan:z-2024-02-01-remove-library-interfaces
Open

Refactoring: remove library interfaces#157
lefessan wants to merge 10 commits intoOCamlPro:masterfrom
lefessan:z-2024-02-01-remove-library-interfaces

Conversation

@lefessan
Copy link
Copy Markdown
Member

@lefessan lefessan commented Feb 1, 2024

Library interfaces are generally a wrong good idea: it hides modules that could be useful later, it renames modules whose source files are then harder to locate, it may contain code that should be in other modules.

So, we must avoid them.

@lefessan lefessan force-pushed the z-2024-02-01-remove-library-interfaces branch from d5ebf47 to eb1016f Compare February 1, 2024 21:35
@lefessan lefessan force-pushed the z-2024-02-01-remove-library-interfaces branch from f87c264 to 03cf06f Compare February 1, 2024 22:32
@nberth nberth self-requested a review February 5, 2024 15:42
Copy link
Copy Markdown
Collaborator

@nberth nberth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a whole this PR gathers some changes I adhere to, and some I am strongly opposed to:

  • I am against removing interface module in libraries that mostly define types and associated utilities (like the parse tree): I do not want to have to type Types all the time, while I still want to mention where the types are from in other libraries;
  • I am also against the renaming of many module names for which the prefix indicates where the module belongs to (Src_ and Preproc_ in the preprocessor, data_ in the types for representing the COBO data, etc). When editing files in various libraries at the same time, those prefixes are very useful. Complicated changes in the code often imply editing several libraries at the same time, so I think on the long run that outweighs the additional on-boarding cost.
  • I am in favor of removing the includes from interface modules (so, having Main modules that gather principal points).

All in all, I'd rather opt for a shortened version of this PR where the only remaining interface modules would be a list of module bindings that only remove their respective library-specific prefix (like Lsp_).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

all_types.ml would fit better with our naming scheme.

(**************************************************************************)

open Lsp_project.TYPES
open Project.TYPES
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note Lsp_project defines an LSP-specific view on more general SuperBOL projects. Only having Project makes this quite unclear.

and checked_doc = Cobol_typeck.Outputs.t
and rewinder =
(Cobol_ptree.compilation_group option,
(Cobol_ptree.Types.compilation_group option,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cobol_ptree is a library that should define types and associated visitors and printers. For that one having tot type Types everywhere is very cumbersome. I am highly in favor of keeping the neat interface for that one.

Cobol_typeck.compilation_group ~config ptree |>
Cobol_typeck.translate_diagnostics ~config |>
Cobol_typeck.Engine.compilation_group ~config ptree |>
Cobol_typeck.Engine.translate_diagnostics ~config |>
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe Main instead of Engine for cobol_typeck as well.

open Lsp_completion_keywords
open Lsp.Types

module POSITION = Lsp.Types.Position
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that POSITION is highly confusing and makes the code below less readable. In this case I'd just remove that definition and always qualify with Lsp.Types..

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd keep Server_loop for that one, that's more precise.

@lefessan
Copy link
Copy Markdown
Member Author

lefessan commented Feb 9, 2024

FWIW, the subject is not whether we keep some package interfaces or not, we will get rid of all of them for readability and navigation issues. The question is more how to make it while keeping some consistency and ease of programming and qualifying things.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants